﻿using Abp.Domain.Entities;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Mt.Site.Core.Synchronization
{
    /*
     SynchorizationFileObjectJob
     
     
     
     */
    public interface ISynchronizationHelper
    {
        /// <summary>
        /// 获取当前母站对应的所有子站
        /// </summary>
        /// <returns></returns>
        IReadOnlyList<SonSiteInfo> GetSonSite(int fromTenantId, string fromLanguage, long menuId, bool isForMenuItem = false);

        /// <summary>
        /// 获取当前分站的母站信息
        /// </summary>
        /// <param name="currentTenantId"></param>
        /// <param name="currentLanguage"></param>
        /// <returns></returns>
        MotherSiteInfo GetMotherSiteInfo(int currentTenantId, string currentLanguage);

        /// <summary>
        /// 判断某条内容是否开启数据自动同步
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        bool ShouldSynchronize(Entity<Guid> entity);

        /// <summary>
        /// 判断某分站是否开启数据同步
        /// </summary>
        /// <param name="tenantId"></param>
        /// <returns></returns>
        bool ShouldSynchronize(int tenantId);

        /// <summary>
        /// 通过关系表中保存的内容id,查找附件对应的内容数据,用于同步关系数据
        /// </summary>
        /// <param name="contentId"></param>
        /// <param name="tenantId"></param>
        /// <returns></returns>
        Entity<Guid> FindContentTypeByContentGuid(Guid contentId, int tenantId);
        /// <summary>
        /// 通过关系表中保存的内容id（整型）,查找附件对应的内容数据,用于同步关系数据
        /// </summary>
        /// <param name="contentId"></param>
        /// <param name="tenantId"></param>
        Entity<Guid> FindContentTypeByContentId(long contentId, int tenantId, string language);

        /// <summary>
        /// 通知变更数据所属栏目的管理员
        /// </summary>
        /// <param name="args"></param>
        Task SendNoticeForSuccessAsync(NoticeArgs args);

        /// <summary>
        /// 通知变更数据所属栏目的管理员
        /// </summary>
        /// <param name="args"></param>
        Task SendNoticeForFailAsync(NoticeArgs args);

        /// <summary>
        /// 通知具有指定权限的管理员
        /// </summary>
        /// <param name="args"></param>
        Task SendNoticeForSuccessAsync(NoticeArgs args, long? menuId, List<string> permissions);
        /// <summary>
        /// 通知具有指定权限的管理员
        /// </summary>
        /// <param name="args"></param>
        Task SendNoticeForFailAsync(NoticeArgs args, long? menuId, List<string> permissions);

        /// <summary>
        /// 同步自定义路由数据(内容的自定义路由)
        /// </summary>
        /// <param name="fromId"></param>
        /// <param name="toId"></param>
        /// <param name="toTenantId"></param>
        /// <param name="LanguageName"></param>
        void SyncRouteStr(Guid fromId, Guid toId, int toTenantId, string LanguageName);
        /// <summary>
        /// 同步自定义路由数据(栏目的自定义路由，需传入语种，因为一个分站下存在多个语言版本时，它们会共用同一套栏目数据，需要用语种名做进一步查询)
        /// </summary>
        /// <param name="fromId"></param>
        /// <param name="toId"></param>
        /// <param name="toTenantId"></param>
        /// <param name="LanguageName"></param>
        void SyncRouteStr(Guid fromId, string fromLanguageName, Guid toId, int toTenantId, string LanguageName);

        /// <summary>
        /// 删除内容时删除对应的自定义路由
        /// </summary>
        /// <param name="relatedId"></param>
        Task DeleteSyncRouteAsync(Guid relatedId, int tenantId);

        /// <summary>
        /// 删除内容时删除对应的自定义SEo
        /// </summary>
        /// <param name="relatedId"></param>
        void DeleteSeo(Guid relateId);

        /// <summary>
        /// 用整型的栏目id查找Guid类型的栏目id
        /// </summary>
        /// <param name="auxiliaryId"></param>
        /// <param name="tenantId"></param>
        /// <returns></returns>
        Guid GetMenuId(long auxiliaryId, int tenantId);

        /// <summary>
        /// 用Guid类型的栏目id查找整型的栏目id
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        long GetAuxiliaryIdForMenuItem(Guid Id);
    }
}
